/**
 */
package flowchart.impl;

import flowchart.FlowChart;
import flowchart.FlowchartPackage;
import flowchart.end;
import flowchart.start;
import flowchart.symbols;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Flow Chart</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link flowchart.impl.FlowChartImpl#getSymbols <em>Symbols</em>}</li>
 *   <li>{@link flowchart.impl.FlowChartImpl#getInitial <em>Initial</em>}</li>
 *   <li>{@link flowchart.impl.FlowChartImpl#getEnd <em>End</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FlowChartImpl extends EObjectImpl implements FlowChart {
	/**
   * The cached value of the '{@link #getSymbols() <em>Symbols</em>}' containment reference list.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getSymbols()
   * @generated
   * @ordered
   */
	protected EList<symbols> symbols;

	/**
   * The cached value of the '{@link #getInitial() <em>Initial</em>}' reference.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getInitial()
   * @generated
   * @ordered
   */
	protected start initial;

	/**
   * The cached value of the '{@link #getEnd() <em>End</em>}' reference.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getEnd()
   * @generated
   * @ordered
   */
	protected end end;

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	protected FlowChartImpl() {
    super();
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	protected EClass eStaticClass() {
    return FlowchartPackage.Literals.FLOW_CHART;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public EList<symbols> getSymbols() {
    if (symbols == null)
    {
      symbols = new EObjectContainmentEList<symbols>(symbols.class, this, FlowchartPackage.FLOW_CHART__SYMBOLS);
    }
    return symbols;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public start getInitial() {
    if (initial != null && initial.eIsProxy())
    {
      InternalEObject oldInitial = (InternalEObject)initial;
      initial = (start)eResolveProxy(oldInitial);
      if (initial != oldInitial)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, FlowchartPackage.FLOW_CHART__INITIAL, oldInitial, initial));
      }
    }
    return initial;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public start basicGetInitial() {
    return initial;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public void setInitial(start newInitial) {
    start oldInitial = initial;
    initial = newInitial;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, FlowchartPackage.FLOW_CHART__INITIAL, oldInitial, initial));
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public end getEnd() {
    if (end != null && end.eIsProxy())
    {
      InternalEObject oldEnd = (InternalEObject)end;
      end = (end)eResolveProxy(oldEnd);
      if (end != oldEnd)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, FlowchartPackage.FLOW_CHART__END, oldEnd, end));
      }
    }
    return end;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public end basicGetEnd() {
    return end;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public void setEnd(end newEnd) {
    end oldEnd = end;
    end = newEnd;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, FlowchartPackage.FLOW_CHART__END, oldEnd, end));
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
    switch (featureID)
    {
      case FlowchartPackage.FLOW_CHART__SYMBOLS:
        return ((InternalEList<?>)getSymbols()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
    switch (featureID)
    {
      case FlowchartPackage.FLOW_CHART__SYMBOLS:
        return getSymbols();
      case FlowchartPackage.FLOW_CHART__INITIAL:
        if (resolve) return getInitial();
        return basicGetInitial();
      case FlowchartPackage.FLOW_CHART__END:
        if (resolve) return getEnd();
        return basicGetEnd();
    }
    return super.eGet(featureID, resolve, coreType);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
    switch (featureID)
    {
      case FlowchartPackage.FLOW_CHART__SYMBOLS:
        getSymbols().clear();
        getSymbols().addAll((Collection<? extends symbols>)newValue);
        return;
      case FlowchartPackage.FLOW_CHART__INITIAL:
        setInitial((start)newValue);
        return;
      case FlowchartPackage.FLOW_CHART__END:
        setEnd((end)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public void eUnset(int featureID) {
    switch (featureID)
    {
      case FlowchartPackage.FLOW_CHART__SYMBOLS:
        getSymbols().clear();
        return;
      case FlowchartPackage.FLOW_CHART__INITIAL:
        setInitial((start)null);
        return;
      case FlowchartPackage.FLOW_CHART__END:
        setEnd((end)null);
        return;
    }
    super.eUnset(featureID);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public boolean eIsSet(int featureID) {
    switch (featureID)
    {
      case FlowchartPackage.FLOW_CHART__SYMBOLS:
        return symbols != null && !symbols.isEmpty();
      case FlowchartPackage.FLOW_CHART__INITIAL:
        return initial != null;
      case FlowchartPackage.FLOW_CHART__END:
        return end != null;
    }
    return super.eIsSet(featureID);
  }

} //FlowChartImpl
